{	Problem: http://codeforces.ru/problemset/problem/53/A
 	Verdict: Accepted
}
var i,n:longint; s,t,r:string;
begin
readln(s);
readln(n);
r:='';
for i:=1 to n do begin
    readln(t);
    if (pos(S,T)=1) and ((r='') or (r>t)) then r:=t;
end;
if r='' then write(s) else write(r);
end.